<?php
namespace App\controllers;
use Framework\Database;
class HomeController{
    protected $db;

    public function __construct()
    {
        $config=require basePath('config/db.php');
        $this->db =new Database($config);
    }
    public function index(){
        $listings = $this->db->query('SELECT * FROM listing ORDER BY created_at DESC LIMIT 10')->fetchAll();        loadView('home',[
            'listings'=>$listings
        ]);
    }
}
?>